/*
 * @Author: your name
 * @Date: 2021-06-22 23:07:57
 * @lastEditTime: 2021-07-01 14:53 PM
 * @lastAuthor: Spring
 * @Description: In User Settings Edit
 * @FilePath: \vue-frame\src\store\index.js
 */
import Vue from "vue"
import Vuex from "vuex"

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    token: localStorage.getItem("token") || 0,
    info: JSON.parse(localStorage.getItem("info")),
    showlogin: false,
    current: 0,
    tag_id: false,
    fansinfo:''
  },
  mutations: {
    setFansInfo(state,item){
      state.fansinfo=item
    },
    setTagId(state, index) {
      state.tag_id = index
    },
    setCurrent(state, index) {
      state.current = index
    },
    setToken(state, token) {
      state.token = token
      localStorage.setItem("token", token)
    },
    setInfo(state, info) {
      state.info = info
      localStorage.setItem("info", JSON.stringify(info))
    },
    showLogin(state) {
      state.showlogin = true
    },
    notshowLogin(state) {
      state.showlogin = false
    },
    judgeLogin(state) {
      if (!state.token||state.token==undefined) {
        this.commit("showLogin")
        return false
      }
      return true
    },
  },
  actions: {},
  modules: {},
})
